
cc.Class({
    extends: cc.Component,

    properties: {
        time_down:cc.Label
    },

    // LIFE-CYCLE CALLBACKS:

    onLoad () {
        this.intervalTime = 1;
        this._time_down = 0;
    },
    setDirection(seatId){
        for(let i = 0;i < 4; i++){
            if(i == seatId){
                this.node.getChildByName('direction_'+i).active = true;
            }else{
                this.node.getChildByName('direction_'+i).active = false;
            };
        };
    },
    start () {
        
    },
    updateTime(time){
        this._time_down = time;
        this.time_down.string = this._time_down;
        if(!this.funUp){
            this.funUp = () =>{
                this._time_down --;
                this.time_down.string = this._time_down;
                if (this._time_down <= 0) {
                    this.unschedule(this.funUp);
                    this.funUp = null;
                };
            };
            this.schedule(this.funUp, 1);
        };
    }

    // update (dt) {
        
    // },
});
